{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "3cba8a51",
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "e7d45c9a",
   "metadata": {},
   "outputs": [],
   "source": [
    "df = pd.read_excel(r'D:\\jupyter\\DK\\DK数据\\2数据处理\\3聚类\\2应用研究\\主题年份计算\\4文档属于主题的概率.xlsx')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "ea006777",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(18218, 8)\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>编号</th>\n",
       "      <th>TI 文献标题</th>\n",
       "      <th>PY 出版年</th>\n",
       "      <th>预处理文本</th>\n",
       "      <th>预处理文本2</th>\n",
       "      <th>Document</th>\n",
       "      <th>Topic</th>\n",
       "      <th>Probability</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>9857</td>\n",
       "      <td>Sliding Backstepping Control Design for Roboti...</td>\n",
       "      <td>2014</td>\n",
       "      <td>slide backstepping control design robotic mani...</td>\n",
       "      <td>slide backstepping control design robotic mani...</td>\n",
       "      <td>slide backstepping control design robotic mani...</td>\n",
       "      <td>0</td>\n",
       "      <td>0.910798</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>15811</td>\n",
       "      <td>Calibration of Embedded Force Sensor for Robot...</td>\n",
       "      <td>2016</td>\n",
       "      <td>calibration embedded force sensor robotic hand...</td>\n",
       "      <td>calibration embed force sensor robotic hand ma...</td>\n",
       "      <td>calibration embed force sensor robotic hand ma...</td>\n",
       "      <td>0</td>\n",
       "      <td>0.846442</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>866</td>\n",
       "      <td>Energy-saving task assignment for robotic fish...</td>\n",
       "      <td>2015</td>\n",
       "      <td>energy-saving task assignment robotic fish sen...</td>\n",
       "      <td>energy-saving task assignment robotic fish sen...</td>\n",
       "      <td>energy-saving task assignment robotic fish sen...</td>\n",
       "      <td>0</td>\n",
       "      <td>0.218918</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>13042</td>\n",
       "      <td>An Interaction-Torque Controller for Robotic E...</td>\n",
       "      <td>2012</td>\n",
       "      <td>interaction-torque controller robotic exoskele...</td>\n",
       "      <td>controller robotic exoskeleton flexible joint ...</td>\n",
       "      <td>controller robotic exoskeleton flexible joint ...</td>\n",
       "      <td>0</td>\n",
       "      <td>0.926832</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1049</td>\n",
       "      <td>Design and Evaluation of a Three-axis Force/To...</td>\n",
       "      <td>2014</td>\n",
       "      <td>design evaluation three-axis force/torque sens...</td>\n",
       "      <td>design evaluation three-axis force/torque sens...</td>\n",
       "      <td>design evaluation three-axis force/torque sens...</td>\n",
       "      <td>0</td>\n",
       "      <td>0.955854</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "      编号                                            TI 文献标题  PY 出版年  \\\n",
       "0   9857  Sliding Backstepping Control Design for Roboti...    2014   \n",
       "1  15811  Calibration of Embedded Force Sensor for Robot...    2016   \n",
       "2    866  Energy-saving task assignment for robotic fish...    2015   \n",
       "3  13042  An Interaction-Torque Controller for Robotic E...    2012   \n",
       "4   1049  Design and Evaluation of a Three-axis Force/To...    2014   \n",
       "\n",
       "                                               预处理文本  \\\n",
       "0  slide backstepping control design robotic mani...   \n",
       "1  calibration embedded force sensor robotic hand...   \n",
       "2  energy-saving task assignment robotic fish sen...   \n",
       "3  interaction-torque controller robotic exoskele...   \n",
       "4  design evaluation three-axis force/torque sens...   \n",
       "\n",
       "                                              预处理文本2  \\\n",
       "0  slide backstepping control design robotic mani...   \n",
       "1  calibration embed force sensor robotic hand ma...   \n",
       "2  energy-saving task assignment robotic fish sen...   \n",
       "3  controller robotic exoskeleton flexible joint ...   \n",
       "4  design evaluation three-axis force/torque sens...   \n",
       "\n",
       "                                            Document  Topic  Probability  \n",
       "0  slide backstepping control design robotic mani...      0     0.910798  \n",
       "1  calibration embed force sensor robotic hand ma...      0     0.846442  \n",
       "2  energy-saving task assignment robotic fish sen...      0     0.218918  \n",
       "3  controller robotic exoskeleton flexible joint ...      0     0.926832  \n",
       "4  design evaluation three-axis force/torque sens...      0     0.955854  "
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "print(df.shape)\n",
    "df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "64651003",
   "metadata": {},
   "outputs": [],
   "source": [
    "def computer_power_year(df, topic):\n",
    "    # 获取相应主题\n",
    "    topic_df = df[df['Topic'] == topic]\n",
    "    # 先算probability占比，然后占比乘年份求和\n",
    "    power_year_ls = []\n",
    "    for year,probability in zip(topic_df['PY 出版年'].values,topic_df['Probability'].values):\n",
    "        power = probability/topic_df['Probability'].sum()\n",
    "        power_year = power * year\n",
    "        power_year_ls.append(power_year)\n",
    "    finally_year = sum(power_year_ls)\n",
    "    # 合并所有归属于当前主题的文档\n",
    "    text = topic_df['Document'].values\n",
    "    \n",
    "    return finally_year, text"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "cacdd874",
   "metadata": {},
   "outputs": [],
   "source": [
    "data = pd.DataFrame()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "adecc4bb",
   "metadata": {},
   "outputs": [],
   "source": [
    "data['主题'] = [i for i in range(0,len(df['Topic'].unique()))]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "abf2c974",
   "metadata": {},
   "outputs": [],
   "source": [
    "ls_year, ls_text = [], []\n",
    "for i in range(0,len(df['Topic'].unique())):\n",
    "    finally_year, text = computer_power_year(df, i)\n",
    "    ls_year.append(round(finally_year,3))\n",
    "    ls_text.append(text)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "4666e3d3",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 保存主题对应的文档\n",
    "topic_doc = {}\n",
    "for i in range(len(ls_text)):\n",
    "    topic_doc[data['主题'].values[i]] = ls_text[i]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "ddc2b9a1",
   "metadata": {},
   "outputs": [],
   "source": [
    "import pickle\n",
    "with open(r'D:\\jupyter\\DK\\DK数据\\2数据处理\\3聚类\\4主题关联\\1应用研究主题-文档内容.pkl','wb') as f:\n",
    "    pickle.dump(topic_doc,f)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "070cf7ea",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "e20c3d6a",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "dd02ecc4",
   "metadata": {},
   "outputs": [],
   "source": [
    "data['年份'] = ls_year"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "16ccca51",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>主题</th>\n",
       "      <th>年份</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0</td>\n",
       "      <td>2016.318</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1</td>\n",
       "      <td>2011.062</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2</td>\n",
       "      <td>2017.022</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>3</td>\n",
       "      <td>2018.477</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>4</td>\n",
       "      <td>2015.219</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>5</td>\n",
       "      <td>2016.315</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>6</td>\n",
       "      <td>2014.096</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>7</td>\n",
       "      <td>2019.290</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>8</td>\n",
       "      <td>2018.797</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>9</td>\n",
       "      <td>2017.567</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>10</td>\n",
       "      <td>2016.594</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>11</td>\n",
       "      <td>2015.437</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>12</td>\n",
       "      <td>2018.132</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>13</td>\n",
       "      <td>2018.509</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>14</td>\n",
       "      <td>2017.581</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>15</td>\n",
       "      <td>2013.210</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>16</td>\n",
       "      <td>2015.715</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>17</td>\n",
       "      <td>2014.564</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>18</td>\n",
       "      <td>2015.758</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>19</td>\n",
       "      <td>2018.807</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>20</td>\n",
       "      <td>2016.079</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>21</td>\n",
       "      <td>2020.103</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>22</td>\n",
       "      <td>2020.486</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>23</td>\n",
       "      <td>2018.240</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>24</td>\n",
       "      <td>2018.695</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>25</td>\n",
       "      <td>2015.594</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>26</td>\n",
       "      <td>2018.645</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>27</td>\n",
       "      <td>2015.081</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "    主题        年份\n",
       "0    0  2016.318\n",
       "1    1  2011.062\n",
       "2    2  2017.022\n",
       "3    3  2018.477\n",
       "4    4  2015.219\n",
       "5    5  2016.315\n",
       "6    6  2014.096\n",
       "7    7  2019.290\n",
       "8    8  2018.797\n",
       "9    9  2017.567\n",
       "10  10  2016.594\n",
       "11  11  2015.437\n",
       "12  12  2018.132\n",
       "13  13  2018.509\n",
       "14  14  2017.581\n",
       "15  15  2013.210\n",
       "16  16  2015.715\n",
       "17  17  2014.564\n",
       "18  18  2015.758\n",
       "19  19  2018.807\n",
       "20  20  2016.079\n",
       "21  21  2020.103\n",
       "22  22  2020.486\n",
       "23  23  2018.240\n",
       "24  24  2018.695\n",
       "25  25  2015.594\n",
       "26  26  2018.645\n",
       "27  27  2015.081"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "efc55af3",
   "metadata": {},
   "outputs": [],
   "source": [
    "topic_words = pd.read_excel(r'D:\\jupyter\\DK\\DK数据\\2数据处理\\3聚类\\2应用研究\\4主题-主题词.xlsx')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "161b0158",
   "metadata": {},
   "outputs": [],
   "source": [
    "topic_words_ls = []\n",
    "for i in range(0,len(df['Topic'].unique())):\n",
    "    words_ls = topic_words.iloc[:,i+1].values\n",
    "    words = '@'.join(words_ls)\n",
    "    topic_words_ls.append(words)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "9f0dc0fd",
   "metadata": {},
   "outputs": [],
   "source": [
    "data['主题词'] = topic_words_ls"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "aba0db0b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>主题</th>\n",
       "      <th>年份</th>\n",
       "      <th>主题词</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0</td>\n",
       "      <td>2016.318</td>\n",
       "      <td>robot@weld@method@system@control@position@base...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1</td>\n",
       "      <td>2011.062</td>\n",
       "      <td>wafer@semiconductor@transfer@chamber@position@...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2</td>\n",
       "      <td>2017.022</td>\n",
       "      <td>fruit@harvest@pick@cut@meat@carcass@image@toma...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>3</td>\n",
       "      <td>2018.477</td>\n",
       "      <td>mow@grass@mower@lawn@cut@boundary@lawnmower@ob...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>4</td>\n",
       "      <td>2015.219</td>\n",
       "      <td>catheter@ablation@capsule@brachytherapy@roboti...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>5</td>\n",
       "      <td>2016.315</td>\n",
       "      <td>pipe@pipeline@pipette@inspection@robot@inpipe@...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>6</td>\n",
       "      <td>2014.096</td>\n",
       "      <td>sample@cell@blood@dna@protein@liquid@automate@...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>7</td>\n",
       "      <td>2019.290</td>\n",
       "      <td>print@printing@additive@manufacturing@printer@...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>8</td>\n",
       "      <td>2018.797</td>\n",
       "      <td>fire@firefighting@extinguish@flame@water@tempe...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>9</td>\n",
       "      <td>2017.567</td>\n",
       "      <td>student@education@robotics@educational@enginee...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>10</td>\n",
       "      <td>2016.594</td>\n",
       "      <td>weed@spray@crop@pesticide@plant@agricultural@g...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>11</td>\n",
       "      <td>2015.437</td>\n",
       "      <td>emotion@emotional@expression@user@facial@inter...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>12</td>\n",
       "      <td>2018.132</td>\n",
       "      <td>food@dish@cook@kitchen@meal@cooking@menu@recip...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>13</td>\n",
       "      <td>2018.509</td>\n",
       "      <td>park@vehicle@parking@car@garage@space@robot@lo...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>14</td>\n",
       "      <td>2017.581</td>\n",
       "      <td>temperature@heat@thermal@compensation@infrared...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>15</td>\n",
       "      <td>2013.210</td>\n",
       "      <td>nanowire@afm@nanomanipulation@nanomanipulator@...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>16</td>\n",
       "      <td>2015.715</td>\n",
       "      <td>brake@motor@release@drive@torque@shaft@robot@a...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>17</td>\n",
       "      <td>2014.564</td>\n",
       "      <td>magnetic@field@geomagnetic@sensor@position@mag...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>18</td>\n",
       "      <td>2015.758</td>\n",
       "      <td>cloth@garment@textile@sew@clothes@fabric@handl...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>19</td>\n",
       "      <td>2018.807</td>\n",
       "      <td>shoe@glue@sole@spray@footwear@upper@track@edge...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>20</td>\n",
       "      <td>2016.079</td>\n",
       "      <td>medicine@pharmacy@medication@drug@storage@deli...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>21</td>\n",
       "      <td>2020.103</td>\n",
       "      <td>substation@inspection@transformer@meter@equipm...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>22</td>\n",
       "      <td>2020.486</td>\n",
       "      <td>sterilize@disinfection@disinfect@clean@epidemi...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>23</td>\n",
       "      <td>2018.240</td>\n",
       "      <td>paint@painting@artwork@artistic@artist@style@r...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>24</td>\n",
       "      <td>2018.695</td>\n",
       "      <td>steel@iron@alloy@core@temperature@titanium@ing...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>25</td>\n",
       "      <td>2015.594</td>\n",
       "      <td>tire@rim@wheel@test@sealant@assembly@drum@anth...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>26</td>\n",
       "      <td>2018.645</td>\n",
       "      <td>chess@chessboard@chessman@game@image@play@proc...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>27</td>\n",
       "      <td>2015.081</td>\n",
       "      <td>carton@unloader@unload@pile@conveyor@robotic@t...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "    主题        年份                                                主题词\n",
       "0    0  2016.318  robot@weld@method@system@control@position@base...\n",
       "1    1  2011.062  wafer@semiconductor@transfer@chamber@position@...\n",
       "2    2  2017.022  fruit@harvest@pick@cut@meat@carcass@image@toma...\n",
       "3    3  2018.477  mow@grass@mower@lawn@cut@boundary@lawnmower@ob...\n",
       "4    4  2015.219  catheter@ablation@capsule@brachytherapy@roboti...\n",
       "5    5  2016.315  pipe@pipeline@pipette@inspection@robot@inpipe@...\n",
       "6    6  2014.096  sample@cell@blood@dna@protein@liquid@automate@...\n",
       "7    7  2019.290  print@printing@additive@manufacturing@printer@...\n",
       "8    8  2018.797  fire@firefighting@extinguish@flame@water@tempe...\n",
       "9    9  2017.567  student@education@robotics@educational@enginee...\n",
       "10  10  2016.594  weed@spray@crop@pesticide@plant@agricultural@g...\n",
       "11  11  2015.437  emotion@emotional@expression@user@facial@inter...\n",
       "12  12  2018.132  food@dish@cook@kitchen@meal@cooking@menu@recip...\n",
       "13  13  2018.509  park@vehicle@parking@car@garage@space@robot@lo...\n",
       "14  14  2017.581  temperature@heat@thermal@compensation@infrared...\n",
       "15  15  2013.210  nanowire@afm@nanomanipulation@nanomanipulator@...\n",
       "16  16  2015.715  brake@motor@release@drive@torque@shaft@robot@a...\n",
       "17  17  2014.564  magnetic@field@geomagnetic@sensor@position@mag...\n",
       "18  18  2015.758  cloth@garment@textile@sew@clothes@fabric@handl...\n",
       "19  19  2018.807  shoe@glue@sole@spray@footwear@upper@track@edge...\n",
       "20  20  2016.079  medicine@pharmacy@medication@drug@storage@deli...\n",
       "21  21  2020.103  substation@inspection@transformer@meter@equipm...\n",
       "22  22  2020.486  sterilize@disinfection@disinfect@clean@epidemi...\n",
       "23  23  2018.240  paint@painting@artwork@artistic@artist@style@r...\n",
       "24  24  2018.695  steel@iron@alloy@core@temperature@titanium@ing...\n",
       "25  25  2015.594  tire@rim@wheel@test@sealant@assembly@drum@anth...\n",
       "26  26  2018.645  chess@chessboard@chessman@game@image@play@proc...\n",
       "27  27  2015.081  carton@unloader@unload@pile@conveyor@robotic@t..."
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "726780dd",
   "metadata": {},
   "outputs": [],
   "source": [
    "data.to_excel(r'D:\\jupyter\\DK\\DK数据\\2数据处理\\3聚类\\2应用研究\\主题年份计算\\5应用研究-主题年份及主题词.xlsx',index = False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "e80c51ba",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "c0c02134",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
